export default {
  props: {
    defaultConfig: {
      type: Object,
      required: true
    },
    changeEvt: {
      type: Function,
      required: false
    },
    config: {
      type: Object,
      default: function() {
        return this.defaultConfig.initData || {}
      },
      required: false
    }
  },
  computed: {
    updateConfig: function() {
      const defaultConfig = require('@/filters/index').assignCopy(this.defaultConfig.initData)
      return Object.assign(...defaultConfig, this.config)
    }
  },
  methods: {
    filterCustormParams(item = {}) {
      const scope = {}
      let custorm = []
      const itemKeys = Object.keys(item)
      if (!Array.isArray(this.config.custormParams) || this.config.custormParams.length === 0) {
        custorm = this.defaultConfig.custormParams
      } else {
        custorm = this.config.custormParams
      }
      console.log(this.config, 'this.defaultConfig=>this.defaultConfig')
      custorm.map(key => {
        if (itemKeys.includes(key)) {
          scope[`${key}`] = item[key]
        }
      })
      return scope
    }
  }
}
